import { Global, Module } from '@nestjs/common';
import { TaskController } from './controller/TaskController';
import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from './entity/User';
import { UserService } from './services/UserService';
import { UserController } from './controller/UserController';
import { Role } from './entity/Role';
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core';
import { ValidationPipe } from './pipe/validationPipe';
import { AuthService } from './services/AuthService';
import { TokenController } from './controller/TokenController';
import { AuthGurd } from './gurd/AuthGurd';
import { HttpExceptionFilter } from './filter/HttpExceptionFilter';
import { ResponseInterceptor } from './interceptor/response';
@Global()
@Module({
  imports: [TypeOrmModule.forFeature([User, Role])],
  controllers: [TaskController, UserController, TokenController],
  providers: [
    UserService,
    AuthService,
    {
      provide: APP_PIPE,
      useClass: ValidationPipe,
    },
    {
      provide: APP_GUARD,
      useClass: AuthGurd,
    },
    {
      provide: APP_FILTER,
      useClass: HttpExceptionFilter,
    },
    {
      provide: APP_INTERCEPTOR,
      useClass: ResponseInterceptor,
    },
  ],
  exports: [],
})
export class CoreModule {}
